function defaultHeight() {
    //console.log(screen.availHeight);
    //let ih = screen.availHeight;
    let ih = window.innerHeight;
    let it = document.getElementById("main-header").scrollHeight;
    let ib = document.getElementById("main-footer").scrollHeight;
    let main = document.getElementById("main-body");
    main.style.height = ih - it - ib + 'px';
    console.log(window.innerWidth + " " + window.innerHeight + " " + it + " " + ib);
}
function doSetTargetID(that) {
    let idx = $(that).data("idx");
    $("#change-pswd-target").val(idx);
    console.log(idx);
}
function doChangePswdConfirm() {
    let p = $(".change-pswd").eq(0).val();
    let c = $(".change-pswd").eq(1).val();
    console.log(p + " " + c);
    if (p == c) {
        $("#change-pswd-alert").hide();
        $("#change-pswd-save").prop("disabled", false);
    } else {
        $("#change-pswd-alert").show();
        $("#change-pswd-save").prop("disabled", true);
    }
}
function doChangePswdSave() {
    let idx = $("#change-pswd-target").val();
    let p = $(".change-pswd").eq(0).val();
    let c = $(".change-pswd").eq(1).val();
    if (!idx) {
        alert("索引错误");
        return
    }
    if (!p == c) {
        alert("密码校验失败");
        return
    }
    let csrf = $('input[name="csrfmiddlewaretoken"]').val();
    $.post("/admin/root/", { "act": "pwsd", "idx": idx, "pswd": b64_md5(p).toUpperCase(), "csrfmiddlewaretoken": csrf }, function (data, status) {
        alert("数据: \n" + data + "\n状态: " + status);
        if (data == "seccuss") {
            $("#change-pswd-stop").click();
        }
    });
}
function doloadweb(frame, url) {
    frame.load(url);
}
$(document).ready(function () {
    $(".menu").on("click", function () {
        console.log($(this));
        let url = $(this).data("url");
        console.log(url);
        if (!url) {
            return
        }
        let fram = $("#main-body-page");
        doloadweb(fram, url);
    });

    // $(".change-pswd").blur(function(){
    //     console.log(this.value);
    // });
});